package com.fengmi.controller;

import com.fengmi.dto.PageDTO;
import com.fengmi.entity.MallGoodsTemplate;
import com.fengmi.service.IMallGoodsTemplateService;
import com.fengmi.vo.PageResultVO;
import com.fengmi.vo.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 作者：陈学虎
 * 时间：2021/7/9 0009 下午 4:13
 */
@RestController
@CrossOrigin
@RequestMapping("/temp")
@Api(description = "模板接口信息")
public class MallGoodsTemplateController {

    @Autowired
    private IMallGoodsTemplateService templateService;

    @PostMapping("/findPage")
    @ApiOperation("分页条件查询接口")
    public PageResultVO<MallGoodsTemplate> findPage(@RequestBody @ApiParam("分页参数dto") PageDTO<MallGoodsTemplate> pageDTO){
        return templateService.findPage(pageDTO);
    }

    @PostMapping("save")
    @ApiOperation("保存模板接口")
    public ResultVO save(@RequestBody MallGoodsTemplate mallGoodsTemplate){
        return templateService.save(mallGoodsTemplate);
    }

    @GetMapping("findAllTemp")
    @ApiOperation("查询所有模板")
    public List<MallGoodsTemplate> findAllTemp(){
        return templateService.findAllTemp();
    }
}
